﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AddTeachSumup.aspx.cs"
    Inherits="ZX.WebApp.Crm.Sale.AddTeachSumup" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <link rel="stylesheet" type="text/css" href="../../scripts/yui_2.9.0/build/container/assets/skins/sam/container.css" />
    <link rel="stylesheet" type="text/css" href="../../scripts/yui_2.9.0/build/button/assets/skins/sam/button.css" />
    <link rel="stylesheet" type="text/css" href="../../scripts/yui_2.9.0/build/layout/assets/skins/sam/layout.css" />
    <link rel="stylesheet" type="text/css" href="../../scripts/yui_2.9.0/build/resize/assets/skins/sam/resize.css" />
    <link rel="stylesheet" type="text/css" href="../../Scripts/yui_2.9.0/build/datatable/assets/skins/sam/datatable.css" />
    <link href="../../Styles/base.css" rel="stylesheet" type="text/css" />
    <script src="../../Scripts/jquery-1.6.min.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery.json-2.2.js" type="text/javascript"></script>
    <script src="../../Scripts/Jquery.form.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery.calendar.js" type="text/javascript"></script>
    <link href="../../Styles/default/calendar.css" rel="stylesheet" type="text/css" />
    <script src="../../Scripts/CombinButton.js" type="text/javascript"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/yahoo-dom-event/yahoo-dom-event.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/element/element-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/datasource/datasource-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/json/json-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/connection/connection-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/get/get-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/dragdrop/dragdrop-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/datatable/datatable-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/paginator/paginator-min.js"></script>
    <script type="text/javascript" src="../../scripts/yui_2.9.0/build/layout/layout-min.js"></script>
    <script type="text/javascript" src="../../scripts/yui_2.9.0/build/button/button-min.js"></script>
    <script type="text/javascript" src="../../scripts/yui_2.9.0/build/container/container-min.js"></script>
    <script type="text/javascript" src="../../scripts/yui_2.9.0/build/treeview/treeview-min.js"></script>
    <script type="text/javascript" src="../../scripts/yui_2.9.0/build/resize/resize-min.js"></script>
    <script type="text/javascript" src="../../scripts/yui_2.9.0/build/event-delegate/event-delegate-min.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/yahoo-dom-event/yahoo-dom-event.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/connection/connection-min.js"></script>
    <link href="../../Styles/extendTable.css" rel="stylesheet" type="text/css" />
    <script src="../../Scripts/extend.validate.js" type="text/javascript"></script>
    <style>
        table, td
        {
            border: 0px solid #cccccc;
            border-collapse: collapse;
        }
    </style>
</head>
<body class="yui-skin-sam" alink="RbStandard">
    <form id="form1" runat="server">
    <div>
        <div id="toolbar" style="margin-top: 12px; text-align: center;">
            <button type="button" id="btnSave" name="btnSave">
                保存</button>&nbsp;&nbsp;&nbsp;&nbsp;          
            <button type="button" id="btnClose" name="btnClose">
                取消</button>
        </div>
        <div class="fieldForm" id="fieldForm">
            <table class="tableContent">
                <tr>
                    <td colspan="6" style="color: Blue;">
                        成交信息
                    </td>
                </tr>
                <tr>
                    <td width="120">
                        &nbsp;订单编号:<span style="color: Red">*</span>
                    </td>
                    <td colspan="5">
                        <asp:DropDownList ID="DDLOrder" name="ValutaID" runat="server" Width="158px">
                        </asp:DropDownList>
                        <span class="span_font">系统自动带出行销顾问给一推讲师下的约场订单,订单状态是待交付</span>
                    </td>
                </tr>
                <tr>
                    <td width="120">
                        &nbsp;客户编码:
                    </td>
                    <td>
                        <input type="text" id="CustomerCode" name="CustomerCode" runat="server" disabled="disabled"
                            style="width: 150px; background: #e7eaf4;" />
                    </td>
                    <td width="120">
                        &nbsp;客户名称:
                    </td>
                    <td>
                        <input type="text" id="CustomerName" name="CustomerName" runat="server" disabled="disabled"
                            style="width: 150px; background: #e7eaf4;" />
                    </td>
                    <td width="120">
                        &nbsp;所属行业:
                    </td>
                    <td>
                        <input type="text" id="Tradename" name="TradeId" runat="server" disabled="disabled"
                            style="width: 150px; background: #e7eaf4;" />
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;信息专员:
                    </td>
                    <td>
                        <input type="text" id="Username" name="PersonId" runat="server" disabled="disabled"
                            style="width: 150px; background: #e7eaf4;" />
                    </td>
                    <td>
                        &nbsp;行销顾问:
                    </td>
                    <td>
                        <input type="text" id="SaleName" name="PersonId0" runat="server" disabled="disabled"
                            style="width: 150px; background: #e7eaf4;" />
                    </td>
                    <td>
                        &nbsp;所属分公司:<span style="color: Red">*</span>
                    </td>
                    <td>
                        <input type="hidden" id="DeptID" runat="server" name="DeptID" class="yui-dept" />
                        <input id="txtDeptID" name="txtDeptID" type="text" runat="server" disabled="disabled"
                            value="" class="yui-text" dtype="G" style="width: 150px; background: #e7eaf4;" />
                        <button id="btnDeptID" class="btnCheck" name="7" runat="server" type="button" style="width: 50px;
                            height: 25px;">
                            选择
                        </button>
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;企业地址:
                    </td>
                    <td colspan="5">
                        <input type="text" id="Address" name="Address" runat="server" disabled="disabled"
                            style="width: 150px; background: #e7eaf4;" />
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;讲课日期:<span style="color: Red">*</span>
                    </td>
                    <td>
                        <input type="text" id="Date" name="OrderDate0" runat="server" disabled="disabled"
                            style="width: 150px; background: #e7eaf4;" />
                    </td>
                    <td>
                        &nbsp;助教:<span style="color: Red">&nbsp;*</span>
                    </td>
                    <td>
                        <input type="hidden" id="Teachsumupid" name="Teachsumupid" runat="server" />
                        <input type="hidden" id="type" name="type" runat="server" />
                        <input type="hidden" id="UserID" name="UserID" runat="server" />
                        <input id="txtUserID" name="txtUserID" type="text" runat="server" disabled="disabled"
                            value="" class="yui-text" style="width: 150px; background: #e7eaf4;" />
                        <button id="btnUserID" name="Z" runat="server" type="button" class="btnCheck" style="width: 50px;
                            height: 25px;">
                            选择
                        </button>
                    </td>
                    <td>
                        &nbsp;讲课地点:
                    </td>
                    <td>
                        <input type="text" id="TeachPlace" name="OrderAddress" runat="server" style="width: 150px;
                            background: #e7eaf4;" disabled="disabled" />
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;讲场类型:<span style="color: Red">*</span>
                    </td>
                    <td>
                        <asp:DropDownList ID="HmtypeID" name="TypeID" runat="server" Width="158px">
                            <asp:ListItem Value="P">上午</asp:ListItem>
                            <asp:ListItem Value="A">下午</asp:ListItem>
                            <asp:ListItem Value="N">晚上</asp:ListItem>
                        </asp:DropDownList>
                    </td>
                    <td>
                        &nbsp;JWX指标:<span style="color: Red">&nbsp;*</span>
                    </td>
                    <td>
                        <asp:DropDownList ID="DDlJWX" name="ValutaID" runat="server" Width="158px">
                        </asp:DropDownList>
                    </td>
                    <td>
                        &nbsp;有效场:<span style="color: Red">&nbsp;*</span>
                    </td>
                    <td>
                        <asp:RadioButtonList ID="RbValue" runat="server" RepeatDirection="Horizontal" Width="158">
                            <asp:ListItem Value="1" Selected="True">是</asp:ListItem>
                            <asp:ListItem Value="0">否</asp:ListItem>
                        </asp:RadioButtonList>
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;标准场:<span style="color: Red">*</span>
                    </td>
                    <td>
                        <asp:RadioButtonList ID="RbStandard" runat="server" RepeatDirection="Horizontal"
                            Width="158">
                            <asp:ListItem Value="1">是</asp:ListItem>
                            <asp:ListItem Value="0" Selected="True">否</asp:ListItem>
                        </asp:RadioButtonList>
                    </td>
                    <td>
                        &nbsp;成交场:<span style="color: Red">&nbsp;*</span>
                    </td>
                    <td>
                        <asp:RadioButtonList ID="RbBargain" runat="server" RepeatDirection="Horizontal"
                            Width="158">
                            <asp:ListItem Value="1" >是</asp:ListItem>
                            <asp:ListItem Value="0" Selected="True">否</asp:ListItem>
                        </asp:RadioButtonList>
                    </td>
                    <td>
                        &nbsp;预计上大课地点:<span style="color: Red">&nbsp;</span></td>
                    <td>
                        <input type="text" id="Explain" name="OrderAddress2" runat="server" style="width: 150px;
                            background: #FFFFFF;" />
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;上课场:<span style="color: Red">*</span>
                    </td>
                    <td>
                        <asp:RadioButtonList ID="RbClass" runat="server" RepeatDirection="Horizontal" Width="158">
                            <asp:ListItem Value="1" Selected="True">是</asp:ListItem>
                            <asp:ListItem Value="0">否</asp:ListItem>
                        </asp:RadioButtonList>
                    </td>
                    <td>
                        &nbsp;抱怨原因:
                    </td>
                    <td>
                        <input type="text" id="GripeExplain" name="OrderDate1" runat="server" style="width: 150px;
                            background: #FFFFFF;" />
                    </td>
                    <td>
                        &nbsp;预计上大课时间:<span style="color: Red">&nbsp;</span></td>
                    <td>
                        <input type="text" id="ClassExplain" name="OrderAddress0" runat="server" class="yui-date"
                            dtype="D" style="width: 150px; background: #FFFFFF;" />
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;籍贯:
                    </td>
                    <td>
                        <input type="text" id="Homeplace" name="OrderDate1" runat="server" style="width: 150px;
                            background: #FFFFFF;" />
                    </td>
                    <td>
                        &nbsp;生日类型:
                    </td>
                    <td>
                        <asp:RadioButtonList ID="RbBirthdayType" runat="server" RepeatDirection="Horizontal"
                            Width="158">
                            <asp:ListItem Value="0" Selected="True">阴历</asp:ListItem>
                            <asp:ListItem Value="1">阳历</asp:ListItem>
                        </asp:RadioButtonList>
                    </td>
                    <td>
                        &nbsp;生日:
                    </td>
                    <td>
                        <input type="text" id="DecisionBirthday" name="OrderAddress0" runat="server" class="yui-date"
                            dtype="D" style="width: 150px; background: #FFFFFF;" />
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;性格:
                    </td>
                    <td>
                        <input type="text" id="Character" name="OrderDate1" runat="server" style="width: 150px;
                            background: #FFFFFF;" />
                    </td>
                    <td>
                        &nbsp;学历:
                    </td>
                    <td>
                        <input type="text" id="SchoolScientifc" name="OrderAddress1" runat="server" style="width: 150px;
                            background: #FFFFFF;" />
                    </td>
                    <td>
                        &nbsp;个人爱好与专长:
                    </td>
                    <td>
                        <input type="text" id="DecisionFancy" name="OrderAddress0" runat="server" style="width: 150px;
                            background: #FFFFFF;" />
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;荣誉:
                    </td>
                    <td colspan="5">
                        <input type="text" id="Credit" name="OrderDate2" runat="server"
                            onKeyDown="showSetNum('Credit','ShowCredit',100)" 
                            onKeyUp="showSetNum('Credit','ShowCredit',100)" 
                            onblur="showSetNull('ShowCredit')"
                            style="width: 50%; background: #FFFFFF;" />
                        <span class="span_font" id="ShowCredit"></span>
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;个人创业史:
                    </td>
                    <td colspan="5">
                        <input type="text" id="Pullulation" name="OrderDate2"
                            onKeyDown="showSetNum('Pullulation','ShowPullulation',500)" 
                            onKeyUp="showSetNum('Pullulation','ShowPullulation',500)" 
                            onblur="showSetNull('ShowPullulation')"
                            runat="server" style="width: 50%; background: #FFFFFF;" />
                        <span class="span_font" id="ShowPullulation"></span>
                    </td>
                </tr>
                <tr>
                    <td colspan="6" style="color: Blue;">
                        企业信息
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;成立日期:<span style="color: Red">*</span>
                    </td>
                    <td>
                        <input type="text" id="CompanyCreateDate" name="OrderDate1" runat="server" style="width: 150px;
                            background: #FFFFFF;" />
                    </td>
                    <td>
                        &nbsp;员工人数:<span style="color: Red">*</span>
                    </td>
                    <td>
                        <input type="text" id="PersonSum" name="OrderDate1" runat="server"  onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" style="width: 150px;
                            background: #FFFFFF;" />
                    </td>
                    <td>
                        &nbsp;产值:<span style="color: Red">*</span>
                    </td>
                    <td>
                        <input type="text" id="ProductSum" name="OrderAddress1" runat="server" style="width: 150px;
                            background: #FFFFFF;" />
                        万
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;公司毛利润:
                    </td>
                    <td>
                        <input type="text" id="CompanyGain" name="OrderAddress0" runat="server" style="width: 150px;
                            background: #FFFFFF;" />万
                    </td>
                    <td>
                        &nbsp;决策层人数:
                    </td>
                    <td>
                        <input type="text" id="DecisionPersonsun" name="OrderDate1" runat="server"  onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" style="width: 150px;
                            background: #FFFFFF;" />
                    </td>
                    <td>
                        &nbsp;高层人数:
                    </td>
                    <td>
                        <input type="text" id="HighPersonsum" name="OrderAddress1" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"  runat="server" style="width: 150px;
                            background: #FFFFFF;" />
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;中层人数:
                    </td>
                    <td>
                        <input type="text" id="MiddlePersonsum" name="OrderAddress0" runat="server"  onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" style="width: 150px;
                            background: #FFFFFF;" />
                    </td>
                    <td>
                        &nbsp;基层人数:
                    </td>
                    <td>
                        <input type="text" id="BelowPersonsum" name="OrderDate1"  onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')"  runat="server" style="width: 150px;
                            background: #FFFFFF;" />
                    </td>
                    <td>
                        &nbsp;合作过的培训公司:
                    </td>
                    <td>
                        <input type="text" id="TrainCompany" name="OrderAddress1" runat="server" style="width: 150px;
                            background: #FFFFFF;" />
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;培训时间:
                    </td>
                    <td>
                        <input type="text" id="TrainDate" name="OrderAddress0" runat="server" class="yui-date"
                            dtype="D" style="width: 150px; background: #FFFFFF;" />
                    </td>
                    <td>
                        &nbsp;影响决策的人:<span style="color: Red">*</span>
                    </td>
                    <td>
                        <input type="text" id="AffectDecisioner" name="OrderAddress1" runat="server" style="width: 150px;
                            background: #FFFFFF;" />
                    </td>
                    <td>
                        &nbsp;成交家数:<span style="color: Red">*</span>
                    </td>
                    <td>
                        <input type="text" id="BargainNum" name="OrderAddress3" runat="server" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" style="width: 150px;
                            background: #FFFFFF;" />
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;培训形式和内容:
                    </td>
                    <td colspan="5">
                        <input type="text" id="TrainHistory" name="OrderDate1" runat="server" style="width: 150px;
                            background: #FFFFFF;" />
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;企业痛苦点:<span style="color: Red">*</span>
                    </td>
                    <td colspan="8">
                        <textarea runat="server" id="Painful" name="Painful" 
                            style="width: 80%; height: 60px; overflow: hidden;"
                            onKeyDown="showSetNum('Painful','ShowPainful',500)" 
                            onKeyUp="showSetNum('Painful','ShowPainful',500)" 
                            onblur="showSetNull('ShowPainful')">
                        </textarea>
                        <span class="span_font" id="ShowPainful"></span>   
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;企业发展史:
                    </td>
                    <td colspan="5">
                        <textarea runat="server" id="CustomerPhylogeny" name="CustomerPhylogeny" 
                            style="width: 80%; height: 60px; overflow: hidden;"
                            onKeyDown="showSetNum('CustomerPhylogeny','ShowCustomerPhylogeny',500)" 
                            onKeyUp="showSetNum('CustomerPhylogeny','ShowCustomerPhylogeny',500)" 
                            onblur="showSetNull('ShowCustomerPhylogeny')">
                       </textarea>
                       <span class="span_font" id="ShowCustomerPhylogeny"></span>  
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;成交原因及过程:<span style="color: Red">*</span>
                    </td>
                    <td colspan="5">
                        <textarea runat="server" id="BargainReason" name="BargainReason" 
                            style="width: 80%; height: 60px;"
                            onKeyDown="showSetNum('BargainReason','ShowBargainReason',500)" 
                            onKeyUp="showSetNum('BargainReason','ShowBargainReason',500)" 
                            onblur="showSetNull('ShowBargainReason')">
                        </textarea>
                        <span class="span_font" id="ShowBargainReason"></span>
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;成交中遇到抗拒点:<span style="color: Red">*</span>
                    </td>
                    <td colspan="5">
                        <textarea  id="BargainDispute" name="Explain"  runat="server"
                            style="width: 80%; height: 80px; "
                            onKeyDown="showSetNum('BargainDispute','ShowBargainDispute',500)" 
                            onKeyUp="showSetNum('BargainDispute','ShowBargainDispute',500)" 
                            onblur="showSetNull('ShowBargainDispute')">
                        </textarea>
                        <span class="span_font" id="ShowBargainDispute"></span>
                   </td>
                </tr>
                <tr height="50" valign="top">
                    <td>
                        &nbsp;对客户的承诺:<span style="color: Red">*</span>
                    </td>
                    <td colspan="5">
                        <input type="text" id="CustomerPromis" 
                            name="OrderDate2" runat="server" 
                            style="width: 50%;height: 23px;"
                            onKeyDown="showSetNum('CustomerPromis','ShowCustomerPromis',100)" 
                            onKeyUp="showSetNum('CustomerPromis','ShowCustomerPromis',100)" 
                            onblur="showSetNull('ShowCustomerPromis')" />
                        <span class="span_font">如果没有承诺，请填写"无"</span>
                        <span class="span_font" id="ShowCustomerPromis"></span>
                    </td>
                </tr>
                <%-- <tr>
                    <td width="120" height="30">影响决策的人：</td>
                    <td colspan="7" class="style7">
                            <input type="text" id="Text15" name="OrderDate2" runat="server"
                        style="width:99%; background: #FFFFFF;"  /></td>
                    <td class="style8"></td>
                    </tr>--%>
            </table>
        </div>
    </div>
    <div id="dialog1" class="yui-pe-content">
        <div class="hd">
            人员选择</div>
        <div class="bd">
            <iframe id="EditUIWindow1" frameborder="0" src="" style="width: 100%; height: 100%;
                margin: 0px; padding: 0px;"></iframe>
        </div>
    </div>
    <div id="dialog2" class="yui-pe-content">
        <div class="hd">
            业绩归属选择</div>
        <div class="bd">
            <iframe id="EditUIWindow2" frameborder="0" src="" style="width: 100%; height: 100%;
                margin: 0px; padding: 0px;"></iframe>
        </div>
    </div>
    <asp:RadioButtonList ID="RbGripe" runat="server" RepeatDirection="Horizontal" Visible="false">
        <asp:ListItem Value="1">是</asp:ListItem>
        <asp:ListItem Value="0" Selected="True">否</asp:ListItem>
    </asp:RadioButtonList>
    </form>
</body>
<script type="text/javascript">
    var flag = "<%=strType %>", condition = "";
    <asp:Literal ID="EditTemplate" runat="server"></asp:Literal>
    var btnSave = "",  btnClose = "";
    (function () {
    var Dom = YAHOO.util.Dom,
            Event = YAHOO.util.Event;
        Event.onDOMReady(function () {
            var layout = new YAHOO.widget.Layout({
                units: [
                { position: 'bottom', height: 60, body: 'toolbar', gutter: '1 1 1 1', scroll: null, zIndex: 2 },
                { position: 'center', body: 'fieldForm', gutter: '0 1 1 1', scroll: true }
                ]
            });
            layout.render();
        });
    })();
    YAHOO.example.init = function () {
        function onButtonClick(p_oEvent) {
            switch (this.get("id")) {
                case "btnSave":
                    Save();
                    break;             
                case "btnClose":
                    Close();
                    break;
                default:
                    break;
            }
        }
        YAHOO.util.Event.onContentReady("toolbar", function () {
            btnSave = new YAHOO.widget.Button("btnSave");
            btnSave.on("click", onButtonClick);          
            btnClose = new YAHOO.widget.Button("btnClose");
            btnClose.on("click", onButtonClick);
            if (flag == 1) {
                btnSave._button.style.display = "none";
                $("#btnSave").attr('disabled', "true");                  
            }

        });
    } ();
    //订单选择对应的方法和ID
    var _fn, _id;
    function ShowDialog(fn, id,scr) {
        _fn = fn;
        _id = id;
        document.getElementById("EditUIWindow1").src = src;
        YAHOO.example.container.dialog1.show();
    }
    //业绩归属选择对应的方法和ID
    var _fn, _id;
    function ShowDialog2(fn, id) {
        _fn = fn;
        _id = id;
        YAHOO.example.container.dialog2.show();
    }
    YAHOO.namespace("example.container");
    YAHOO.util.Event.onDOMReady(function () {
        var handleSubmit = function () {
            var editwindow = document.getElementById("EditUIWindow1");
            if (editwindow) {
                editwindow.contentWindow.ChooseInfo();
            }
            YAHOO.example.container.dialog1.hide();
        };
        var handleSubmit2 = function () {
            var editwindow = document.getElementById("EditUIWindow2");
            if (editwindow) {
                if(_id=="btnDeptID"){
                    editwindow.contentWindow.Save();
                }else{
                    editwindow.contentWindow.ChooseInfo();
                }
            }
            YAHOO.example.container.dialog2.hide();
        };
        var handleCancel = function () {
            this.cancel();
        };
        var handleSuccess = function (o) {
            var response = o.responseText;
            response = response.split("<!")[0];
            document.getElementById("resp").innerHTML = response;
        };
        var handleFailure = function (o) {
            alert("Submission failed: " + o.status);
        };
        YAHOO.example.container.dialog1 = new YAHOO.widget.Dialog("dialog1",
					            { width: "550px",
					                height: "450px",
					                fixedcenter: true,
					                visible: false,
					                draggable: true,
					                close: true,
					                autofillheight: "body",
					                constraintoviewport: true,
					                buttons: [{ text: "确定", handler: handleSubmit, isDefault: true },
								            { text: "取消", handler: handleCancel}]
					            });
        YAHOO.example.container.dialog2 = new YAHOO.widget.Dialog("dialog2",
					            { width: "360px",
					                height: "450px",
					                fixedcenter: true,
					                visible: false,
					                draggable: true,
					                close: true,
					                autofillheight: "body",
					                constraintoviewport: true,
					                buttons: [{ text: "确定", handler: handleSubmit2, isDefault: true },
								            { text: "取消", handler: handleCancel}]
					            });
        YAHOO.example.container.dialog1.callback = { success: handleSuccess, failure: handleFailure };
        YAHOO.example.container.dialog1.render();
        YAHOO.example.container.dialog2.callback = { success: handleSuccess, failure: handleFailure };
        YAHOO.example.container.dialog2.render();
    });


   
    //保存
    var queryString = function (key) {
        return (document.location.search.match(new RegExp("(?:^\\?|&)" + key + "=(.*?)(?=&|$)")) || ['', null])[1];
    }

    var replace = function (str) {
        return str.replace(/^\s+|\s+$/g, "");
    }
    /*var oldValue="";
    function setValue() {
      instance[0].ID = $('#ID').val();
      instance[0].IsGripe = 0;
      instance[0].IsClass = $("input[name='RbClass']:checked").val();
      instance[0].IsBargain = $("input[name='RbBargain']:checked").val();
      instance[0].OrderId = $("DDLOrder").value();
      instance[0].ThodometerId = $('#ID').val();;
      instance[0].IsStandard = $("#City").find("option:selected").text();
      instance[0].JWXID = $("#DDlJWX").val();
      instance[0].DeptId = $('#DeptID').val();

      instance[0].GripeExplain = $('#GripeExplain').val();
      instance[0].ClassExplain = $('#ClassExplain').val();

      instance[0].Explain = $('#Explain').val();

      instance[0].Explain = $('#Explain').val();


      instance[0].DecisionPosition = $('#DecisionPosition').val();
      instance[0].DecisionSex = $('#DecisionSex').val();
      instance[0].CompanyProduct = $('#CompanyProduct').val();
      instance[0].Tel1 = $('#Tel1').val();
      instance[0].Tel2 = $('#Tel2').val();
      instance[0].DecisionEmail = $('#DecisionEmail').val();
      instance[0].Post = $('#Post').val();
      instance[0].CompanyAttention = $('#CompanyAttention').val();
      instance[0].CusTestimony = $('#CusTestimony').val();
      instance[0].Fax = $('#Fax').val();
    }*/
    var Save = function () {
         /* oldValue = $.toJSON(instance[0]).replace(/'/g, "[B]");
          setValue();*/
          if( $("DDLOrder").val() ==""  &&  $("DDLOrder").val() =="undefined" )
          {
             alert("订单不能为空!");
             $('#DDLOrder').focus();
              return;
          }
          if($('#DeptID').val() == "")
          {
             alert("所属分公司不能为空");
             $('#DeptID').focus();
             return;
          }
//          if($('#Explain').val() == "")
//          {
//             alert("预计上大课地点不能为空");
//             $('#Explain').focus();
//             return;
//          }
//          if($('#ClassExplain').val() == "")
//          {
//             alert("预计上大课时间不能为空");
//             $('#ClassExplain').focus();
//             return;
//          }txtUserID
          if($('#txtUserID').val() == "")
          {
             alert("助教不能为空");
             $('#txtUserID').focus();
             return;
          }
          if($('#DecisionBirthday').val()=="")
          {
              alert("生日不可以为空");
             $('#DecisionBirthday').focus();
             return;
          }
          if($('#CompanyCreateDate').val() == "")
          {
             alert("企业成立时间不能为空");
             $('#CompanyCreateDate').focus();
             return;
          }
          if($('#PersonSum').val() == "")
          {
             alert("企业员工不能为空");
             $('#PersonSum').focus();
             return;
          }
          if($('#AffectDecisioner').val() == "")
          {
             alert("影响决策人的人不能为空");
             $('#AffectDecisioner').focus();
             return;
          }
          if($('#BargainNum').val() == "")
          {
             alert("成交家数不能为空");
             $('#BargainNum').focus();
             return;
          }
         /*ProductSum*/
           if($('#ProductSum').val() == "")
          {
             alert("产值不能为空");
             $('#ProductSum').focus();
             return;
          }
           if($('#Painful').val() == "")
          {
             alert("企业痛苦点不能为空");
             $('#Painful').focus();
             return;
          }
          if($('#BargainReason').val() == "")
          {
             alert("成交原因和过程不能为空");
             $('#BargainReason').focus();
             return;
          }
          if($('#Painful').val() == "")
          {
             alert("企业痛苦点不能为空");
             $('#Painful').focus();
             return;
          }
          if($('#Painful').val().length > 500)
          {
             alert("企业痛苦点字数不可以大于500");
             $('#Painful').focus();
             return;
          }
          if($('#BargainDispute').val() == "")
          {
             alert("成交中遇到的抗拒点不能为空");
             $('#BargainDispute').focus();
             return;
          }
          if($('#BargainDispute').val().length > 500)
          {
             alert("成交中遇到的抗拒点字数不可以大于500");
             $('#BargainDispute').focus();
             return;
          }
          if($('#CustomerPromis').val() == "")
          {
             alert("对客户的承诺不能为空");
             $('#CustomerPromis').focus();
             return;
          }
          if($('#CustomerPromis').val().length > 100)
          {
             alert("对客户的承诺不可以大于100");
             $('#CustomerPromis').focus();
             return;
          }
          
        var TeachSumup = "0" + "︾"
                 + $("input[name='RbClass']:checked").val() + "︾"
                 + $("input[name='RbBargain']:checked").val() + "︾"
                 + replace(document.getElementById("DDLOrder").value.toString()) + "︾"
                 + $("input[name='RbStandard']:checked").val() + "︾"
                 + replace(document.getElementById("DDlJWX").value.toString()) + "︾"
                 + replace(document.getElementById("DeptID").value.toString()) + "︾"
                 + replace(document.getElementById("UserID").value.toString()) + "︾"
                 + replace(document.getElementById("GripeExplain").value.toString()) + "︾"
                 + replace(document.getElementById("ClassExplain").value.toString()) + "︾"
                 + replace(document.getElementById("Explain").value.toString()) + "︾"
                 + replace(document.getElementById("Date").value.toString()) + "︾"
                 + replace(document.getElementById("TeachPlace").value.toString()) + "︾"
                 + replace(document.getElementById("CustomerPromis").value.toString()) + "︾"
                 + replace(document.getElementById("PersonSum").value.toString()) + "︾"
                 + replace(document.getElementById("ProductSum").value.toString()) + "︾"
                 + replace(document.getElementById("CompanyGain").value.toString()) + "︾"
                 + replace(document.getElementById("TrainHistory").value.toString()) + "︾"
                 + replace(document.getElementById("Painful").value.toString()) + "︾"
                 + replace(document.getElementById("Pullulation").value.toString()) + "︾"
                 + replace(document.getElementById("Homeplace").value.toString()) + "︾"
                 + $("input[name='RbBirthdayType']:checked").val() + "︾"
                 + replace(document.getElementById("DecisionBirthday").value.toString()) + "︾"
                 + replace(document.getElementById("Character").value.toString()) + "︾"
                 + replace(document.getElementById("SchoolScientifc").value.toString()) + "︾"
                 + replace(document.getElementById("DecisionFancy").value.toString()) + "︾"
                 + replace(document.getElementById("Credit").value.toString()) + "︾"
                 + replace(document.getElementById("CompanyCreateDate").value.toString()) + "︾"
                 + replace(document.getElementById("DecisionPersonsun").value.toString()) + "︾"
                 + replace(document.getElementById("HighPersonsum").value.toString()) + "︾"
                 + replace(document.getElementById("MiddlePersonsum").value.toString()) + "︾"
                 + replace(document.getElementById("BelowPersonsum").value.toString()) + "︾"
                 + replace(document.getElementById("TrainCompany").value.toString()) + "︾"
                 + replace(document.getElementById("TrainDate").value.toString()) + "︾"
                 + replace(document.getElementById("CustomerPhylogeny").value.toString()) + "︾"
                 + replace(document.getElementById("BargainReason").value.toString()) + "︾"
                 + replace(document.getElementById("BargainDispute").value.toString()) + "︾"
                 + replace(document.getElementById("AffectDecisioner").value.toString()) + "︾"
                 + replace(document.getElementById("BargainNum").value.toString())+ "︾"
                 + $("input[name='RbValue']:checked").val(); 
        var id = queryString("ID");
        var type = document.getElementById("type").value.toString();
        var Teachsumupid = document.getElementById("Teachsumupid").value.toString();
        var returnstr= TeachSumup+"︽"+id+"︽"+type+"︽"+Teachsumupid;
        var   returnint= ZX.WebApp.Crm.Sale.AddTeachSumup.Save(returnstr).value;
          if (returnint == 1 ) {
                alert("保存成功!");
                       Close();
            }
            else
                {
                        alert(returnint);
              } 
//        var request = "SaveTeachSumup.aspx?&TeachSumup=" + encodeURI(TeachSumup) + "&ID=" + id + "&type=" + type + "&Teachsumupid=" + Teachsumupid + "";
//        YAHOO.util.Connect.asyncRequest('POST', request, {
//            success: function (res) {
//                var inventory;
//                try {
//                    inventory = res.responseText;
//                    if (inventory == "1") {
//                        alert("保存成功!");
//                        Close();
//                    } else {
//                        alert(inventory + "\n" + "数据保存失败!");
//                    }
//                }
//                catch (e) {
//                }
//                finally {
//                }
//            },
//            failure: function (error) {
//                alert("读取错误：" + error.statusText);
//            }
//        }, null);

    }
    var trs = $("table tr");
    var showDiv1 = function () {
        if (document.getElementById("hiddenCenter1").value == "隐藏1") {
            for (i = 0; i < trs.length; i++) {

                if (i >= 4 && i <= 10) {
                    trs[i].style.display = "none";
                }

            }
            document.getElementById("hiddenCenter1").value = "显示1";
        } else {
            for (i = 0; i < trs.length; i++) {
                if (i >= 4 && i <= 10) {
                    trs[i].style.display = "block";
                }

            }
            document.getElementById("hiddenCenter1").value = "隐藏1";
        }
    }
    var showDiv2 = function () {
        if (document.getElementById("hidden1").value == "隐藏2") {
            for (i = 0; i < trs.length; i++) {

                if (i >= 12 && i <= 15) {
                    trs[i].style.display = "none";
                }

            }
            document.getElementById("hiddenCenter1").value = "显示2";
        } else {
            for (i = 0; i < trs.length; i++) {
                if (i >= 12 && i <= 15) {
                    trs[i].style.display = "block";
                }

            }
            document.getElementById("hiddenCenter1").value = "隐藏2";
        }
    }
    var showDiv3 = function () {
        if (document.getElementById("hidden2").value == "隐藏3") {
            for (i = 0; i < trs.length; i++) {

                if (i >= 17 && i <= 23) {
                    trs[i].style.display = "none";
                }

            }
            document.getElementById("hidden2").value = "显示3";
        } else {
            for (i = 0; i < trs.length; i++) {
                if (i >= 17 && i <= 23) {
                    trs[i].style.display = "block";
                }

            }
            document.getElementById("hidden2").value = "隐藏3";
        }
    }
    var showDiv4 = function () {
        if (document.getElementById("hidden3").value == "隐藏4") {
            for (i = 0; i < trs.length; i++) {

                if (i >= 25 && i <= 27) {
                    trs[i].style.display = "none";
                }

            }
            document.getElementById("hidden3").value = "显示4";
        } else {
            for (i = 0; i < trs.length; i++) {
                if (i >= 25 && i <= 27) {
                    trs[i].style.display = "block";
                }

            }
            document.getElementById("hidden3").value = "隐藏4";
        }
    }

    //修改
    var Modify = function () {
    }
    //关闭当前页
    var Close = function () {
        window.parent.$("#tabs").tabs('close', '讲师演讲总结');
    }
    $(document).ready(function () {    
        if(queryString("own")=="0"){
            $("input,textarea,select,button").each(function(){
                $(this).attr("disabled","disabled");
            }); 
        }
        $("#ClassExplain").cld();
        $("#TrainDate").cld();
        $("#DecisionBirthday").cld();
        $("#CompanyCreateDate").cld();
    });    
</script>
</html>
